export default app => {
  const { STRING, INTEGER, DATE } = app.Sequelize;

  const applicationArea = app.model.define('application_area', {
    id: { type: INTEGER, primaryKey: true, autoIncrement: true },
    uuid: { type: STRING(36), unique: true },
    name: STRING(10), // 应用领域
    createdAt: DATE,
    updatedAt: DATE,
  });
  applicationArea.associate = () => {
    app.model.ApplicationArea.hasMany(app.model.Product, {
      foreignKey: 'fk_applicationArea',
      sourceKey: 'uuid',
    });
    app.model.ApplicationArea.hasMany(app.model.Talent, {
      foreignKey: 'fk_applicationArea',
      sourceKey: 'uuid',
    });
  };
  return applicationArea;
};
